package com.sunlgggg.view.component;

import static com.sunlgggg.util.HttpRequestUtils.*;

import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;


public class SelectPanel extends JPanel{
	JLabel title ;
	JPanel titlePanel ;
	StudentInfoTable studentInfoTable ;

	public SelectPanel(){

		this.setLayout(new BorderLayout());


		titlePanel = new JPanel();
		titlePanel.setLayout(new BorderLayout());
		titlePanel.setPreferredSize(new Dimension(600, 30));
		title = new JLabel("请输入关键字", SwingConstants.CENTER);

        JTextField selectJTextField = new JTextField();

		selectJTextField.addKeyListener(new KeyListener(){
			@Override
			public void keyTyped(KeyEvent e) {

			}

			@Override
			public void keyPressed(KeyEvent e) {

			}

			@Override
			public void keyReleased(KeyEvent e) {
				if(e.getKeyCode()== KeyEvent.VK_ENTER) {
                    studentInfoTable.load(post("info/find", "keyword=" + selectJTextField.getText()));
				}
			}
		});

		titlePanel.add(title,BorderLayout.WEST);

		titlePanel.add(selectJTextField, BorderLayout.CENTER);


		studentInfoTable = new StudentInfoTable();
		JScrollPane jScrollPane_IL = new JScrollPane(studentInfoTable);
//        jScrollPane_IL.setBounds(5, 5, 637, 275);
		this.add(titlePanel, BorderLayout.NORTH);

		this.add(jScrollPane_IL,BorderLayout.CENTER);

		//this.add(new ManagerOperation(), BorderLayout.SOUTH);

//		this.add(selectjTextField,BorderLayout.CENTER);
//		this.add(titlePanel, BorderLayout.NORTH);
	}

}
